//
//  SelectCheckItemViewController.m
//  MyProject
//
//  Created by Pei on 16/7/8.
//  Copyright © 2016年 Xiaobo Pei. All rights reserved.
//

/*
 
 InspectItemList =     (
 {
 InspectContentList =             (
 {
 InspectContentID = 298;
 InspectContentName = "\U8fdb\U573a\U4eba\U5458\U5e74\U9f84\U3001\U5065\U5eb7\U6761\U4ef6\U4e0d\U7b26\U5408\U8981\U6c42";
 MaxPoints = 10;
 },
 {
 InspectContentID = 299;
 InspectContentName = "\U672a\U7ecf\U5b89\U5168\U6559\U80b2\U57f9\U8bad\U4e0a\U5c97";
 MaxPoints = 10;
 },
 {
 InspectContentID = 300;
 InspectContentName = "\Uff08\U7279\U79cd\U4f5c\U4e1a\Uff09\U672a\U6301\U8bc1\U4e0a\U5c97";
 MaxPoints = 10;
 }
 );
 InspectItemCode = "FDAZ_RYGL_GLL";
 InspectItemID = 132;
 InspectItemName = "\U4eba\U5458\U7ba1\U7406";
 InspectType = 0;
 RiskName = "\U7ba1\U7406";
 RiskType = 0;
 },
 
 */

#import "SelectCheckItemViewController.h"
#import "SelectMajorViewController.h"

#import "SelectCell.h"
#import "SelectModel.h"
#import "HeaderView.h"


@interface SelectCheckItemViewController ()<SelectMajorViewControllerDelegate,UITableViewDelegate, UITableViewDataSource, UIScrollViewDelegate>
{
    NSDictionary *_dataDic;
    
    NSDictionary *superDic;
    
    UITextField *searchField;
    
    UITableView *_myTable;
    
    NSArray *dataArray;
    UIView *backView;
    
    SelectMajorViewController *majorVC;
}

//@property(nonatomic,strong)UITableView *myTabeleView;
//@property(nonatomic,strong)NSMutableArray *myDataArr;
//@property(nonatomic,strong)HeaderView *myAllheadVIew;
//@property(nonatomic,strong)HeaderView  *mySomeHeadVIew;
//@property(nonatomic,strong)NSMutableArray *mySelectDataArr;

@end

@implementation SelectCheckItemViewController

- (void)viewDidLoad {
    self.navTitle = @"选择检查项";
    
    [super viewDidLoad];
    

    
    self.view.backgroundColor = kWhiteColor;
    
    majorVC = [[SelectMajorViewController alloc] init];
    majorVC.delegateMajor = self;
    
    UIButton *rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 70, 22)];
    [rightBtn setTitle:@"工程专业" forState:UIControlStateNormal];
    [rightBtn setTitleColor:kBlueColor forState:UIControlStateNormal];
    rightBtn.titleLabel.font = kAppFont(Home_Big_Size);
    [rightBtn addTarget:self action:@selector(rightBtnAcion) forControlEvents:UIControlEventTouchUpInside];
    [self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithCustomView:rightBtn]];
    
    backView = [[UIView alloc] init];
    backView.frame = CGRectMake(10.0f, 10.0f, kDeviceWidth-20.0f-60.0f-10.0f, 40.0f);
    backView.layer.borderWidth = 0.5f;
    backView.layer.borderColor = kRGBA(0, 0, 0, 0.26f).CGColor;
    backView.layer.cornerRadius = 5.0f;
    backView.layer.masksToBounds = YES;
    backView.backgroundColor = kWhiteColor;
    [self.view addSubview:backView];
    
    
    searchField = [[UITextField alloc] init];
    searchField.frame = CGRectMake(15.0f, 10.0f, kDeviceWidth-30.0f-60.0f-10.0f, 40.0f);
    searchField.placeholder = @"搜索";
    [self.view addSubview:searchField];
    
    UIButton *searchBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    searchBtn.frame = CGRectMake(backView.right+10.0f,
                                 10.0f, 60.0f, 40.0f);
    [searchBtn setBackgroundColor:[UIColor clearColor]];
    [searchBtn setTitle:@"搜索" forState:UIControlStateNormal];
    [searchBtn setTitleColor:kBlueColor forState:UIControlStateNormal];
    searchBtn.titleLabel.font = kAppFont(Home_Big_Size);
    searchBtn.tag = 111;
    [searchBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:searchBtn];
    
    //114 122 162
    UIButton *cancleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    cancleBtn.frame = CGRectMake(0.0f, kDeviceHeight-NAV_HEIGHT-kTabHeight, kDeviceWidth/2.0f, kTabHeight);
    [cancleBtn setBackgroundColor:kRGB(114, 122, 162)];
    [cancleBtn setTitle:@"重置" forState:UIControlStateNormal];
    [cancleBtn setTitleColor:kWhiteColor forState:UIControlStateNormal];
    cancleBtn.titleLabel.font = kAppFont(Home_Big_Size);
    cancleBtn.tag = 116;
    [cancleBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:cancleBtn];
    
    UIButton *uploadBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    uploadBtn.frame = CGRectMake(kDeviceWidth/2.0f, kDeviceHeight-NAV_HEIGHT-kTabHeight, kDeviceWidth/2.0f, kTabHeight);
    [uploadBtn setBackgroundColor:kBtnBackgroundColor];
    [uploadBtn setTitle:@"完成" forState:UIControlStateNormal];
    [uploadBtn setTitleColor:kWhiteColor forState:UIControlStateNormal];
    uploadBtn.titleLabel.font = kAppFont(Home_Big_Size);
    [uploadBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
    uploadBtn.tag = 118;
    [self.view addSubview:uploadBtn];
    
    [self initTableView];
}

//隐藏键盘方法
//-(void)hideKeyboard{
//    [self.view endEditing:YES];
//}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    if (scrollView.contentOffset.y > 0) {
        [self.view endEditing:YES];
    }
}

- (void)initTableView
{
    _myTable = [[UITableView alloc] init];
    _myTable.frame = CGRectMake(0.0f, 10.0f+40.0f+10.0f, kDeviceWidth, kDeviceHeight-NAV_HEIGHT-kTabHeight-20.0f-40.0f);
    _myTable.delegate = self;
    _myTable.dataSource = self;
    [self.view addSubview:_myTable];
    
    _myTable.tableFooterView = [UIView new];
}

- (void)btnAction:(UIButton*)sender{
    switch (sender.tag) {
        case 111://搜索
        {
            [self.view endEditing:YES];
            NSString *searchStr = searchField.text;
            if (searchStr == nil || searchStr.length <= 0) {
                dataArray = [_dataDic objectForKey:@"InspectItemList"];
                
                NSMutableArray *tttttt = [[NSMutableArray alloc] initWithCapacity:3];
                [tttttt removeAllObjects];
                for (int i = 0; i < dataArray.count; i ++) {
                    NSDictionary *rrrr = [dataArray objectAtIndex:i];
                    NSMutableDictionary *aaaa = [[NSMutableDictionary alloc] initWithDictionary:rrrr];
                    [aaaa setValue:@"0" forKey:@"isSelect"];
                    [tttttt addObject:aaaa];
                }
                dataArray = tttttt;
                
                [_myTable reloadData];
            }else{
                NSMutableArray *addArray = [[NSMutableArray alloc] initWithCapacity:3];
                [addArray removeAllObjects];
                for (NSDictionary *temp in dataArray) {
                    NSString *tempStr = [temp valueForKey:@"InspectItemName"];
                    if ([tempStr rangeOfString:searchStr].location != NSNotFound) {
                        [addArray addObject:temp];
                    }
                }
                
                NSMutableArray *tttttt = [[NSMutableArray alloc] initWithCapacity:3];
                [tttttt removeAllObjects];
                for (int i = 0; i < addArray.count; i ++) {
                    NSDictionary *rrrr = [addArray objectAtIndex:i];
                    NSMutableDictionary *aaaa = [[NSMutableDictionary alloc] initWithDictionary:rrrr];
                    [aaaa setValue:@"0" forKey:@"isSelect"];
                    [tttttt addObject:aaaa];
                }
                
                dataArray = addArray;
                [_myTable reloadData];
            }
        }
            break;
        case 116://重置
        {
            NSMutableArray *tttttt = [[NSMutableArray alloc] initWithCapacity:3];
            [tttttt removeAllObjects];
            for (int i = 0; i < dataArray.count; i ++) {
                NSDictionary *rrrr = [dataArray objectAtIndex:i];
                NSMutableDictionary *aaaa = [[NSMutableDictionary alloc] initWithDictionary:rrrr];
                [aaaa setValue:@"0" forKey:@"isSelect"];
                [tttttt addObject:aaaa];
            }
            dataArray = tttttt;
            [_myTable reloadData];
        }
            break;
        case 118://完成
        {
            NSMutableArray *tttttt = [[NSMutableArray alloc] initWithCapacity:3];
            [tttttt removeAllObjects];
            for (int i = 0; i < dataArray.count; i ++) {
                NSDictionary *rrrr = [dataArray objectAtIndex:i];
                NSMutableDictionary *addSuperDic = [[NSMutableDictionary alloc] initWithDictionary:rrrr];
                if ([[rrrr valueForKey:@"isSelect"] intValue] == 1) {
                    [addSuperDic setObject:superDic forKey:@"superDic"];
                    [tttttt addObject:addSuperDic];
                }
                //[aaaa setValue:@"0" forKey:@"isSelect"];
                
            }
            if (tttttt != nil && tttttt.count > 0) {
                if ([self.delegate respondsToSelector:@selector(passSelectModel:)]) {
                    
                    [self.delegate passSelectModel:tttttt];
                    dispatch_async(dispatch_get_main_queue(), ^{
                        [self.navigationController popViewControllerAnimated:YES];
                    });
                    
                }
            }else{
                [[YMUIUtil getInstance] showTipViewAutoDis:@"请选择检查项"];
            }
        }
            break;
        default:
            break;
    }
}


- (void)rightBtnAcion
{
    
    [self.navigationController pushViewController:majorVC animated:YES];
}

//- (void)viewWillDisappear:(BOOL)animated{
//    [super viewWillDisappear:animated];
//    majorVC.delegate = nil;
//}
//
//- (void)viewWillAppear:(BOOL)animated{
//    [super viewWillAppear:animated];
//    if (majorVC) {
//        majorVC.delegate = self;
//    }
//}

//- (void)dealloc{
//    majorVC.delegate = nil;
//}


- (void)passSelectMajor:(NSDictionary *)tempDic
{
    superDic = tempDic;
    
    //Get_Check_Item_By_Major  InspectItemCode={Code}
    [[YMNetLib getInstance] connectWithAction:Get_Check_Item_By_Major_API method:@"GET" withContent:[NSString stringWithFormat:@"InspectItemCode=%@", [tempDic valueForKey:@"SpecialtyCode"]] withBody:nil withDelegate:self];//SpecialtyCode
}

- (void)NetDoOverSuccess:(NSDictionary*)body
{
    if ([[YMNetDataUtil getSuccessState:body] intValue] == 1)
    {
        //_dataArray = [body valueForKey:@"DicList"];
        //[[NSUserDefaults standardUserDefaults] setObject:[body valueForKey:@"DicList"] forKey:Check_Type_Items];
        //[_myTable reloadData];
        
        //[self.mySelectDataArr removeAllObjects];
        
        _dataDic = body;
        
        dataArray = [_dataDic objectForKey:@"InspectItemList"];
        
        //NSMutableArray *tempArray = [[NSMutableArray alloc] initWithArray:dataArray];
        NSMutableArray *tempArray = [[NSMutableArray alloc] initWithCapacity:3];
        [tempArray removeAllObjects];
        for (NSDictionary *tempD in dataArray) {
            NSMutableDictionary *ddd = [[NSMutableDictionary alloc] initWithDictionary:tempD];
            [ddd setValue:@"0" forKey:@"isSelect"];
            [tempArray addObject:ddd];
        }
        
        dataArray = tempArray;
        
        //[self initView];
        //[self initData];
        
        [_myTable reloadData];
    }
}

//- (NSMutableArray *)mySelectDataArr{
//    if (_mySelectDataArr == nil) {
//        _mySelectDataArr = [NSMutableArray array];
//    }
//    return _mySelectDataArr;
//}

//- (NSMutableArray *)myDataArr{
//    if (_myDataArr == nil) {
//        _myDataArr = [NSMutableArray array];
//    }
//    return _myDataArr;
//}


//-(void)initView
//{
//    [self initHeadView ];
//    [self initSomeheadView:CGRectMake(0, CGRectGetMaxY(self.myAllheadVIew.frame) + 10, self.view.frame.size.width, 0.0f)];
//    //[self initSomeheadView:CGRectMake(0, CGRectGetMaxY(self.myAllheadVIew.frame) + 10, self.view.frame.size.width, 30)];
//}
//-(void)initHeadView
//{
//    self.myAllheadVIew = [[HeaderView alloc]initWithFrame:CGRectMake(0, 0.0f, self.view.frame.size.width, 0.0f)];
//    //self.myAllheadVIew = [[HeaderView alloc]initWithFrame:CGRectMake(0, 0.0f, self.view.frame.size.width, 30)];
//    [self.myAllheadVIew upDataWithAll];
//    [self.myAllheadVIew setBackgroundColor:[UIColor grayColor]];
//    __weak SelectCheckItemViewController *weakSelf = self;
//    self.myAllheadVIew.myTapAction = ^(NSInteger tag){
//        NSLog(@"点击所有好友");
//        [weakSelf.mySelectDataArr removeAllObjects];
//        for (int i =0; i< self.myDataArr.count; i++) {
//            GroupModel *groupModel = weakSelf.myDataArr[i];
//            for (int i=0; i<groupModel.myDataArr.count; i++) {
//                SelectModel *tempModel = groupModel.myDataArr[i];
//                tempModel.isSelect = YES;
//                [weakSelf.mySelectDataArr addObject:tempModel];
//            }
//            [weakSelf.mySomeHeadVIew upDateSelectNum:[NSString stringWithFormat:@"%ld",weakSelf.mySelectDataArr.count]];
//            [weakSelf.myTabeleView reloadData];
//        }
//    };
//    [self.view addSubview:self.myAllheadVIew];
//    
//}
//-(void)initSomeheadView:(CGRect)frame
//{
//    self.mySomeHeadVIew = [[HeaderView alloc]initWithFrame:frame];
//    [self.mySomeHeadVIew upDateSelectNum:@"" andWithGroupName:@"部分好友"];
//    [self.mySomeHeadVIew setBackgroundColor:[UIColor grayColor]];
//    SelectCheckItemViewController *tempView = self;
//    self.mySomeHeadVIew.myTapAction = ^(NSInteger tag)
//    {
//        tempView.myTabeleView.hidden = NO;
//        [tempView.myTabeleView reloadData];
//    };
//    [self.view addSubview:self.mySomeHeadVIew];
//    
//    self.myTabeleView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0.0f, self.mySomeHeadVIew.frame.size.width, kDeviceHeight-NAV_HEIGHT)];
//    self.myTabeleView.hidden = NO;
//    self.myTabeleView.delegate = self;
//    self.myTabeleView.dataSource = self;
//    [self.view addSubview:self.myTabeleView];
//    
//    self.myTabeleView.tableFooterView = [UIView new];
//}
//-(void)initData
//{
//    [self.myDataArr removeAllObjects];
//    
//    NSMutableArray *data =[[NSMutableArray alloc]init];
//    
//    NSArray *superArray = [_dataDic objectForKey:@"InspectItemList"];
//    
//    for (int i = 0; i < superArray.count; i ++) {
//        
//        [data removeAllObjects];
//        
//        NSDictionary *tempDic = [superArray objectAtIndex:i];
//        
//        GroupModel *groupModel = [[GroupModel alloc] init];
//        groupModel.InspectItemName = [tempDic valueForKey:@"InspectItemName"];
//        groupModel.InspectItemCode = [tempDic valueForKey:@"InspectItemCode"];
//        groupModel.RiskName = [tempDic valueForKey:@"RiskName"];
//        groupModel.InspectItemID = [[tempDic valueForKey:@"InspectItemID"] intValue];
//        groupModel.InspectType = [[tempDic valueForKey:@"InspectType"] intValue];
//        groupModel.RiskType = [[tempDic valueForKey:@"RiskType"] intValue];
//        groupModel.mySelectNum = [NSString stringWithFormat:@"%d", i];
//        
//        NSArray *tempArray = [tempDic objectForKey:@"InspectContentList"];
//        for (int i = 0; i < tempArray.count; i ++)
//        {
//            NSDictionary *contentDic = [tempArray objectAtIndex:i];
//            SelectModel *selectModel= [[SelectModel alloc] init];
//            selectModel.InspectContentName = [contentDic valueForKey:@"InspectContentName"];
//            selectModel.InspectContentID = [[contentDic valueForKey:@"InspectContentID"] intValue];
//            selectModel.MaxPoints = [[contentDic valueForKey:@"MaxPoints"] intValue];
//            selectModel.groupM = groupModel;
//            [data addObject:selectModel];
//        }
//        
//        [groupModel.myDataArr addObjectsFromArray:data];
//        [self.myDataArr addObject:groupModel];
//    }
//    
//}
#pragma mark UITableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    //return self.myDataArr.count;
    return 1.0f;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    /*
    GroupModel *groupModel = self.myDataArr[section];
    if (groupModel.isExpand == YES) {
        return groupModel.myDataArr.count;
    }
    else
    {
        return 0;
    }
     */
    return dataArray.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 44;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    //return 44;
    return 0.0f;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    /*
    GroupModel *groupModel = self.myDataArr[indexPath.section];
    SelectModel *tempModel = groupModel.myDataArr[indexPath.row];
    tempModel.groupM = groupModel;
    SelectCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
    if (cell == nil) {
        cell = [[SelectCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
    }
    
    cell.block =^(NSInteger tag){
        if (tag == 0) {
            NSLog(@"取消选中");
            NSInteger tempTag = [groupModel.mySelectNum integerValue];
            tempModel.isSelect = tag;
            groupModel.mySelectNum = [NSString stringWithFormat:@"%ld",tempTag-1];
            for (int i=0; i<self.mySelectDataArr.count; i++) {
                SelectModel *tempModel1 = [self.mySelectDataArr objectAtIndex:i];
                if (tempModel.InspectContentID == tempModel1.InspectContentID) {
                    [self.mySelectDataArr removeObject:tempModel1];
                }
            }
        }
        if (tag == 1) {
            NSLog(@"选中");
            NSInteger tempTag = [groupModel.mySelectNum integerValue];
            tempModel.isSelect = tag;
            groupModel.mySelectNum = [NSString stringWithFormat:@"%ld",tempTag+1];
            [self.mySelectDataArr addObject:tempModel];
        }
        
        [self.myTabeleView reloadData];
        [self.mySomeHeadVIew upDateSelectNum:[NSString stringWithFormat:@"%ld",self.mySelectDataArr.count]];
    };
    [cell upDataWithHead:nil andWithFriendName:tempModel.InspectContentName andIsselected:tempModel.isSelect];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
     */
    static NSString *identifier = @"cell_house_History";
    UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    }
    cell.textLabel.textColor = kBlackColor;//kRGB(205, 206, 207);
    cell.textLabel.font = kAppFont(Home_Small_Size+2);
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    NSDictionary *tempDic = [dataArray objectAtIndex:indexPath.row];
    
    if ([[tempDic valueForKey:@"isSelect"] intValue] == 0) {
        cell.accessoryType = UITableViewCellAccessoryNone;
    }else{
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
    }
    
    NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ [%@]",[tempDic valueForKey:@"InspectItemName"], [superDic valueForKey:@"SpecialtyName"]]];
    NSString *InspectItemNameStr = [tempDic valueForKey:@"InspectItemName"];
    NSString *tempStr = [NSString stringWithFormat:@"%@ [%@]",[tempDic valueForKey:@"InspectItemName"], [superDic valueForKey:@"SpecialtyName"]];
    [str addAttribute:NSForegroundColorAttributeName value:kRGB(205, 206, 207) range:NSMakeRange(InspectItemNameStr.length,(tempStr.length-InspectItemNameStr.length))];

    //cell.textLabel.text = [NSString stringWithFormat:@"%@[%@]",[tempDic valueForKey:@"InspectItemName"], [superDic valueForKey:@"SpecialtyName"]];
    cell.textLabel.attributedText = str;
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSDictionary *tempDic = [dataArray objectAtIndex:indexPath.row];
    
    if ([[tempDic valueForKey:@"isSelect"] intValue] == 0) {
        UITableViewCell *newCell = [tableView cellForRowAtIndexPath:
                                    indexPath];
        newCell.accessoryType = UITableViewCellAccessoryCheckmark;
        
        NSMutableDictionary *aaaa = [[NSMutableDictionary alloc] initWithDictionary:tempDic];
        [aaaa setValue:@"1" forKey:@"isSelect"];
        
        NSMutableArray *tttttt = [[NSMutableArray alloc] initWithArray:dataArray];
        for (int i = 0; i < dataArray.count; i ++) {
            NSDictionary *rrrr = [dataArray objectAtIndex:i];
            if ([[rrrr valueForKey:@"InspectItemID"] intValue] == [[aaaa valueForKey:@"InspectItemID"] intValue]){
                [tttttt replaceObjectAtIndex:i withObject:aaaa];
            }
        }
        
        dataArray = tttttt;
        
    }else{
        UITableViewCell *newCell = [tableView cellForRowAtIndexPath:
                                    indexPath];
        newCell.accessoryType = UITableViewCellAccessoryNone;
        
        NSMutableDictionary *aaaa = [[NSMutableDictionary alloc] initWithDictionary:tempDic];
        [aaaa setValue:@"0" forKey:@"isSelect"];
        
        NSMutableArray *tttttt = [[NSMutableArray alloc] initWithArray:dataArray];
        for (int i = 0; i < dataArray.count; i ++) {
            NSDictionary *rrrr = [dataArray objectAtIndex:i];
            if ([[rrrr valueForKey:@"InspectItemID"] intValue] == [[aaaa valueForKey:@"InspectItemID"] intValue]) {
                [tttttt replaceObjectAtIndex:i withObject:aaaa];
            }
        }
        
        dataArray = tttttt;
    }
    [_myTable reloadData];
}

/*
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    HeaderView *view = [[HeaderView alloc]initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 44)];
    view.backgroundColor= [UIColor whiteColor];
    GroupModel *groupModel = [self.myDataArr objectAtIndex:section];
    [view upDateSelectNum:groupModel.mySelectNum andWithGroupName:groupModel.InspectItemName];
    view .myTapAction = ^(NSInteger tag)
    {
        groupModel.isExpand = !groupModel.isExpand;
        NSIndexSet *indexSet = [[NSIndexSet alloc]initWithIndex:section];
        [tableView reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic];
        NSLog(@"关闭或打开分组");
    };
    UIView *lineView = [[UIView alloc] init];
    lineView.frame = CGRectMake(0.0f, 43.5f, kDeviceWidth, 0.5f);
    lineView.backgroundColor = kGreenColor;
    [view addSubview:lineView];
    return view;
}
*/

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end
